Skip to content

Conversation

@myang1220
Copy link
Contributor

Description

Refactoring the existing UserData class as an abstract class, and extending the abstract class as FileUserData. This is in preparation for the saving user data project for Data Explorer, where we will extend the abstract class as AtlasUserData.

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Copilot AI review requested due to automatic review settings July 10, 2025 15:59
@myang1220 myang1220 requested a review from a team as a code owner July 10, 2025 15:59
@myang1220 myang1220 added feat no release notes Fix or feature not for release notes labels Jul 10, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the existing UserData implementation into an abstract IUserData base class with a concrete FileUserData, and updates all storage consumers to use the new API.

  • Introduces IUserData (abstract) and FileUserData in compass-user-data
  • Updates storage modules (queries, pipelines, connections, preferences, history, data modeling, atlas service) to replace UserData with FileUserData
  • Adjusts tests and exports to align with the new types

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/my-queries-storage/src/compass-query-storage.ts Swap to IUserData/FileUserData, adjust methods and signatures
packages/my-queries-storage/src/compass-pipeline-storage.ts Replace UserData with FileUserData
packages/connection-storage/src/compass-main-connection-storage.ts Replace UserData with FileUserData
packages/compass-user-data/src/user-data.ts Extract IUserData, implement FileUserData, update options
packages/compass-user-data/src/user-data.spec.ts Update tests to use FileUserData and its options
packages/compass-user-data/src/index.ts Export IUserData and FileUserData instead of UserData
packages/compass-shell/src/modules/history-storage.ts Swap UserData import for FileUserData
packages/compass-preferences-model/src/user-storage.ts Replace UserData with FileUserData
packages/compass-preferences-model/src/preferences-persistent-storage.ts Swap to FileUserData for preferences storage
packages/compass-data-modeling/src/services/data-model-storage-electron.tsx Replace UserData with FileUserData
packages/compass-data-modeling/src/components/diagram-card.spec.tsx Relax test assertion on modified date
packages/atlas-service/src/secret-store.ts Replace UserData with FileUserData
Comments suppressed due to low confidence (1)

packages/my-queries-storage/src/compass-query-storage.ts:77

  • [nitpick] The comment refers to writing to "system/db", but this implementation writes to the file system. Update the comment to accurately reflect file-based storage.
    // this creates a recent query that we will write to system/db

@myang1220 myang1220 requested a review from Anemy July 10, 2025 16:01
@myang1220 myang1220 requested a review from mabaasit July 10, 2025 18:22
@myang1220 myang1220 merged commit 1e939ef into main Jul 10, 2025
27 of 29 checks passed
@myang1220 myang1220 deleted the user-data-interface branch July 10, 2025 20:37

export type UserDataOptions<Input> = {
export type FileUserDataOptions<Input> = {
subdir: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming on this one is unfortunate, but I think it's also relevant for the shared userdata interface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat no release notes Fix or feature not for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants